import addSelButton from "@/components/diy-form/add-sel-button.vue";
import addSelBg from "@/components/diy-form/add-sel-bg.vue";
export default {
	components:{
		addSelBg,
		addSelButton,
	},
	data() {
		return {
			info:{},
			s_id:0,
			loginStatus:false,
			joinList:[],
			joinListEmpty:'',
			joinListOrderIndex:0,
			joinListOrder:[
				{
					text:'时间降序 ↓',
					order:'desc'
				},
				{
					text:'时间正序 ↑',
					order:'asc'
				}
			]
		}
	},
	onLoad(params){
		var info = uni.getStorageSync('form-daka-detail-preview-data');
		uni.removeStorageSync('form-daka-detail-preview-data')
		var getDateRange = this.$api.getDateRange('',1);
		info.createtime = getDateRange[0];
		this.info = info;
		this.initInfo();
		
	},
	onShow(){
		
	},
	methods: {
		initInfo(){
			let info = this.info;
			if(info.bgPath)
			{
				this.$refs.add_sel_bg.initBgFunc(info.bgPath);
			}
			if(info.contentList)
			{
				this.$refs.add_sel_button.initDataList(info.contentList)
			}
		},
		changeOrder(){
			var that = this;
			var joinListOrder = that.joinListOrder;
			let itemList = [];
			joinListOrder.forEach(item=>{
				itemList.push(item.text);
			})
			uni.showActionSheet({
				itemList:itemList,
				success(e){
					var index = e.tapIndex;
					
					if(index.toString() != that.joinListOrderIndex.toString())
					{
						that.joinListOrderIndex = index;
					}
				}
			})
		},
		makePhone(phone){
			this.$api.makePhone(phone);
		},
		detailBtn(){
			this.$api.msg('预览模式下不支持该操作')
		},
		submit(){
			var info = this.info;
			if(info.opeList.length > 0)
			{
				uni.setStorageSync('common-preview-cache-data',info.opeList);
				this.$api.navigateTo('/pages/common/preview-form');
			}else{
				this.$api.msg('预览模式下不支持该操作')
			}
		}
		
		
	}
}